package org.example.travel_web.controller.admin;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.example.travel_web.dto.data.*;
import org.example.travel_web.service.DataService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/data")
@Tag(name = "数据管理")
public class DataController {

    @Resource
    private DataService dataService;

    @GetMapping("/news/rank")
    @Operation(summary = "获取资讯排行榜")
    public List<NewsRankResp> getNewsRank() {
        return dataService.getNewsRank();
    }

    @GetMapping("/route/rank")
    @Operation(summary = "获取路线排行榜")
    public List<RouteRankResp> getRouteRank() {
        return dataService.getRouteRank();
    }

    @GetMapping("/attraction/rank")
    @Operation(summary = "获取景点排行榜")
    public List<AttractionRankResp> getAttractionRank() {
        return dataService.getAttractionRank();
    }

    @GetMapping("/comment/rank")
    @Operation(summary = "获取评论排行榜")
    public List<CommentRankResp> getCommentRank() {
        return dataService.getCommentRank();
    }

    @GetMapping("/collect/rank")
    @Operation(summary = "获取收藏排行榜")
    public List<CollectRankResp> getCollectRank() {
        return dataService.getCollectRank();
    }

    @GetMapping("/graph/line/data")
    @Operation(summary = "获取折线图数据")
    public LineChartDataResp getLineChartData() {
        return dataService.getLineChartData();
    }

    @GetMapping("/total/data")
    @Operation(summary = "获取总数据")
    public TotalDataResp getTotalData() {
        return dataService.getTotalData();
    }
}
